﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.EquipmentManagement;
using Digitalmes.Model.ProductManagement;
using Digitalmes.Model.ProcessManagement;

namespace Digitalmes.Model.EquipmentManagement
{
    /// <summary>
    /// 点检样件
    /// </summary>
	[Table("EquipmentSpotMaster")]

    [Display(Name = "_Model.EquipmentSpotMaster")]
    public class EquipmentSpotMaster : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._EquipmentSpotMaster._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._EquipmentSpotMaster._MasterBarcode")]
        [Comment("标件条码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string MasterBarcode { get; set; }
        [Display(Name = "_Model._EquipmentSpotMaster._OpId")]
        [Comment("所属工位")]
        public long? OpId { get; set; }

        public ProcessRouteItem Op { get; set; }    

        [Display(Name = "_Model._EquipmentSpotMaster._OpCode")]
        [Comment("所属工位编号")]
        public string OpCode { get; set; }
        [Display(Name = "_Model._EquipmentSpotMaster._SpotType")]
        [Comment("标件类型")]
        public SpotTypeEnum? SpotType { get; set; }
        [Display(Name = "_Model._EquipmentSpotMaster._Active")]
        [Comment("激活")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool? Active { get; set; }
        [Display(Name = "_Model._EquipmentSpotMaster._Equipment")]
        [Comment("关联设备")]
        public Equipment Equipment { get; set; }
        [Display(Name = "_Model._EquipmentSpotMaster._Equipment")]
        [Comment("关联设备")]
        public long? EquipmentId { get; set; }
        [Display(Name = "_Model._EquipmentSpotMaster._LineId")]
        [Comment(" 所属产品")]
        public long? ProductId { get; set; }


        public Product Product { get; set; }


        [Display(Name = "_Model._EquipmentSpotMaster._LineCode")]
        [Comment("所属产品编号")]
        public string ProductCode { get; set; }
        [Display(Name = "_Model._EquipmentSpotMaster._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
